Document filtering by type for children endpoint#8
Document filtering by type for children endpoint#8m-mohr merged 13 commits intostac-api-extensions:mainfrom
Conversation
… general rewrite/update #2
This PR proposes adding an optional `type` query parameter to the `/children` endpoint to support filtering results by resource type (e.g., `Catalog` or `Collection`). ### Motivation While the specification recommends separating different types into different hierarchy branches as a best practice, real-world data organization often results in "mixed content" folders (e.g., a Project Catalog containing both sub-project Catalogs and direct Dataset Collections). In dynamic, database-backed APIs (like those using Elasticsearch), retrieving and paginating mixed-type lists can be computationally expensive and complex to implement. Adding a standard `type` parameter allows: 1. **Backend Optimization:** Implementations can execute efficient, type-specific queries (e.g., `type: "Catalog"`) rather than fetching all children and filtering in memory. 2. **Client Flexibility:** Clients can request only the resource type they are interested in (e.g., "Show me sub-folders" vs. "Show me datasets") without receiving unwanted data. 3. **Standardization:** Prevents the proliferation of custom filter parameters (e.g., `?kind=`, `?filter=`) across different implementations. ### Proposed Change Add a section detailing the `type` parameter: #### Filtering by Type Implementations MAY support a `type` query parameter to allow clients to request a specific resource type. * `GET .../children?type=Catalog` * `GET .../children?type=Collection`
m-mohr
left a comment
There was a problem hiding this comment.
I think I'm fine with the functionality in general, but as it's optional clients may run into issues as they don't know whether it's supported or not. As such, I'd propose to make it an optional conformance class. Something like https://api.stacspec.org/v1.0.0-rc.2/children#type-filter. Should be listed at the top and in the section.
Additionally, you'd need to update the TOC and the OpenAPI document.
Co-authored-by: Matthias Mohr <m.mohr@moregeo.it>
Co-authored-by: Matthias Mohr <m.mohr@moregeo.it>
@jonhealy1 I think this^ is still open. Now that #6 is merged, the CI also fails due to the outdated TOC, I think. Can you please update this PR accordingly? Otherwise, I think it looks good. Changed the base after the merging #6 and tried to resolve the conflicts... |
Updated the section header for 'Filtering by Type' to use proper Markdown formatting.
Added 'type' query parameter to filter catalogs or collections.
Formatted parameters section for consistency.
|
@m-mohr Passing :) |
Co-authored-by: Matthias Mohr <m.mohr@moregeo.it>
|
@m-mohr Thanks :) |
This PR proposes adding an optional
typequery parameter to the/childrenendpoint to support filtering results by resource type (e.g.,CatalogorCollection).Motivation
While the specification recommends separating different types into different hierarchy branches as a best practice, real-world data organization often results in "mixed content" folders (e.g., a Project Catalog containing both sub-project Catalogs and direct Dataset Collections).
In dynamic, database-backed APIs (like those using Elasticsearch), retrieving and paginating mixed-type lists can be computationally expensive and complex to implement.
Adding a standard
typeparameter allows:type: "Catalog") rather than fetching all children and filtering in memory.?kind=,?filter=) across different implementations.Proposed Change
Add a section detailing the
typeparameter:Filtering by Type
Implementations MAY support a
typequery parameter to allow clients to request a specific resource type.GET .../children?type=CatalogGET .../children?type=CollectionRelated Issue(s):
Proposed Changes:
PR Checklist: